#region

using System;
using System.Collections.Generic;
using System.Linq;
using Class.Web.Mvc;
using ThuySan.Bussiness;

#endregion

namespace ThuySan.Repository
{
    public partial class ImageRepository
    {
        #region IImageRepository Members

        public bool CheckInsertImage(Image image)
        {
            return true;
        }

        public bool CheckUpdateImage(Image image)
        {
            return true;
        }

        public bool CheckDeleteImage(IEnumerable<int> enumerable)
        {
            return true;
        }

        public void Delete(IEnumerable<int> enumerable, string uploadPath, Action<string, string, IImageContent> func1, Action<string, string, IImageBrushContent> func2)
        {
            List<Image> images = Select(c => enumerable.Contains(c.Id)).ToList();
            foreach (Image image in images)
            {
                if (!string.IsNullOrEmpty(image.ImageName))
                {
                    func1.Invoke(uploadPath, image.ImageName, image);
                    func2.Invoke(uploadPath, image.ImageName, image);
                }
            }
            Delete(images);
        }

        #endregion
    }
}
